; Music of Oxphar (1987) (Ere Informatique)
; Ripped by Megachur the 19/04/2009

; Need System Vectors

	write "OXPHAR.BIN"

music_date_rip	equ &1349
music_adr	equ &450b
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"
;
.real_init_music
.l450b
;
	ld a,#bc
	ld (l452b),a
	ld bc,#0301
	ld hl,l45e1
	call l4527
	ld a,#bf
	ld (l452b),a
	ld bc,#0601
	ld hl,l45ff
	jp l4527
.l4527
	push bc
	push hl
	ld a,c
.l452b equ $ + 1
	call #bc55
	pop hl
	ld b,(hl)
	inc hl
	ld de,#0003
.l4533
	add hl,de
	djnz l4533
	pop bc
	inc c
	djnz l4527
	ret
	push af
	push hl
	push bc
	push de
	push ix
	push iy
	pop hl
	call #bcaa
	pop ix
	pop de
	pop bc
	pop hl
	pop af
	ret
	push af
	push hl
	push bc
	push de
	call #bca7
	pop de
	pop bc
	pop hl
	pop af
	ret
	db #01,#01,#01,#46,#03,#00,#0c,#20
	db #00,#04,#02,#00,#1f,#00,#00,#0a
	db #06,#00,#04,#02,#00,#60,#00,#00
	db #0a,#06,#00,#01,#02,#00,#05,#00
	db #08,#07,#06,#00,#02,#00,#02,#8d
	db #00,#00,#0c,#23,#00,#02,#00,#03
	db #e9,#03,#00,#0a,#bc,#00,#02,#00
	db #04,#7b,#01,#00,#0c,#53,#00,#02
	db #02,#00,#3c,#00,#00,#0c,#01,#00
	db #02,#02,#00,#10,#00,#00,#0c,#01
	db #00,#02,#02,#00,#3c,#01,#00,#0c
	db #01,#00,#02,#00,#01,#d6,#00,#00
	db #0a,#28,#00,#01,#00,#02,#a0,#01
	db #00,#0c,#0a,#00,#02,#00,#01,#ff
	db #01,#00,#0b,#0f,#00,#03,#02,#00
	db #30,#00,#00,#0c,#06,#00,#03,#02
.l45e1 equ $ + 7
	db #02,#30,#00,#00,#0b,#06,#00,#05
	db #02,#00,#0a,#02,#01,#0a,#01,#fe
	db #0a,#01,#02,#19,#01,#fe,#14,#03
	db #01,#fc,#03,#01,#04,#03,#01,#00
.l45ff equ $ + 5
	db #03,#01,#06,#ff,#02,#05,#02,#00
	db #0a,#02,#d8,#0a,#04,#57,#05,#05
	db #e2,#05,#04,#d8,#05,#03,#01,#88
	db #0a,#04,#05,#0a,#01,#83,#0d,#03
	db #08,#f6,#0f,#08,#80,#0a,#0a,#f0
	db #03,#03,#03,#c6,#0f,#02,#3a,#0a
	db #02,#c6,#0a,#02,#03,#ff,#01,#03
	db #01,#01,#01,#0f,#0f,#01,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#43,#41,#4c,#4c,#20
	db #26,#34,#37,#26,#30,#44,#0d,#43
	db #41,#4c,#4c,#20,#26,#34,#37,#30
	db #30,#34,#37,#30,#30,#32,#00,#00
	db #00,#ff,#ff,#ff,#cc,#00,#33,#ff
	db #ff,#ff,#cc,#00,#33,#cc,#00,#33
	db #ff,#ff,#ff,#4f,#ff,#ff,#6f,#00
	db #00,#00,#00,#00,#00,#00,#00,#00

	defs 2270,0	
	
;#5000
.l5005 equ $ + 5
.l5000
	db #00,#01,#02,#01,#02,#86,#03,#86
	db #03,#5a,#02,#86,#03,#86,#03,#5a
	db #02,#86,#03,#86,#03,#86,#03,#86
	db #03,#5a,#02,#86,#03,#86,#03,#86
	db #03,#86,#03,#86,#03,#38,#02,#38
	db #02,#38,#02,#5a,#02,#5a,#02,#5a
	db #02,#86,#03,#86,#03,#86,#03,#86
	db #03,#86,#03,#86,#03,#f4,#03,#f4
.l5045 equ $ + 5
	db #03,#f6,#02,#f6,#02,#0f,#0d,#0f
	db #0f,#0d,#0f,#0f,#0e,#0d,#0c,#0f
	db #0f,#0f,#0f,#0f,#0d,#0f,#0d,#0c
	db #0f,#0d,#0c,#0f,#0e,#0d,#0c,#0b
.l5065 equ $ + 5
	db #0f,#0f,#0d,#0f,#0d,#e1,#19,#01
	db #19,#96,#96,#96,#96,#e1,#19,#01
	db #01,#01,#01,#19,#01,#e1,#19,#01
	db #19,#96,#96,#96,#96,#e1,#19,#01
	db #01,#01,#01,#19,#01,#e1,#19,#01
	db #19,#96,#96,#96,#96,#e1,#19,#01
	db #01,#01,#01,#19,#01,#e1,#19,#01
	db #19,#96,#96,#96,#96,#e1,#19,#01
.l50a5 equ $ + 5
	db #01,#01,#01,#19,#01,#71,#71,#71
	db #71,#71,#71,#7f,#7f,#96,#96,#96
	db #96,#96,#96,#96,#96,#8e,#8e,#8e
	db #7f,#7f,#7f,#8e,#8e,#96,#96,#96
.l50c5 equ $ + 5
	db #96,#5f,#5f,#71,#71,#71,#71,#71
	db #71,#71,#71,#64,#64,#5f,#5f,#5f
	db #5f,#5f,#5f,#5f,#5f,#64,#64,#54
	db #54,#54,#5f,#64,#5f,#71,#71,#71
.l50e5 equ $ + 5
	db #71,#71,#71,#71,#71,#0f,#0f,#0e
	db #0e,#0d,#0c,#0f,#0d,#0f,#0f,#0e
	db #0e,#0d,#0d,#0c,#0c,#0f,#0e,#0d
	db #0f,#0e,#0d,#0f,#0d,#0f,#0e,#0d
.l5105 equ $ + 5
	db #0c,#0f,#0d,#0f,#0d,#0f,#0f,#0e
	db #0e,#0d,#0c,#0f,#0d,#0f,#0f,#0e
	db #0e,#0d,#0d,#0c,#0c,#0f,#0f,#0f
	db #0d,#0f,#0f,#0f,#0f,#0f,#0f,#0e
.l5125 equ $ + 5
	db #0e,#0d,#0d,#0c,#0c,#f6,#02,#f6
	db #02,#f4,#03,#f6,#02,#f6,#02,#f4
	db #03,#f6,#02,#f4,#03,#53,#03,#53
	db #03,#53,#03,#53,#03,#53,#03,#53
	db #03,#53,#03,#53,#03,#f4,#03,#f4
	db #03,#f4,#03,#f4,#03,#f4,#03,#f4
	db #03,#f4,#03,#f4,#03,#70,#04,#70
	db #04,#70,#04,#b4,#04,#b4,#04,#b4
	db #04,#b4,#04,#b4,#04,#f6,#02,#f6
	db #02,#f4,#03,#f6,#02,#f6,#02,#f4
	db #03,#f6,#02,#f4,#03,#53,#03,#53
	db #03,#53,#03,#53,#03,#53,#03,#53
	db #03,#53,#03,#53,#03,#f4,#03,#f4
	db #03,#f4,#03,#70,#04,#70,#04,#70
	db #04,#f4,#03,#f4,#03,#f6,#02,#f6
	db #02,#f6,#02,#f6,#02,#f6,#02,#f6
.l51a5 equ $ + 5
	db #02,#f6,#02,#f6,#02,#0f,#0d,#0f
	db #0f,#0d,#0f,#0f,#0f,#0f,#0f,#0e
	db #0e,#0d,#0d,#0c,#0c,#0f,#0e,#0d
	db #0f,#0e,#0d,#0f,#0d,#0f,#0e,#0d
	db #0f,#0e,#0d,#0d,#0c,#0f,#0d,#0f
	db #0f,#0d,#0f,#0f,#0d,#0f,#0f,#0e
	db #0e,#0d,#0d,#0c,#0c,#0f,#0e,#0d
	db #0f,#0e,#0d,#0f,#0d,#0f,#0f,#0e
.l51e5 equ $ + 5
	db #0e,#0e,#0d,#0d,#0c,#5f,#5f,#5f
	db #4b,#4b,#4b,#5f,#5f,#6a,#6a,#6a
	db #6a,#6a,#6a,#6a,#6a,#54,#54,#54
	db #47,#47,#47,#38,#38,#3f,#3f,#3f
	db #4b,#4b,#4b,#4b,#4b,#5f,#5f,#5f
	db #4b,#4b,#4b,#5f,#5f,#6a,#6a,#6a
	db #6a,#6a,#6a,#6a,#6a,#54,#54,#54
	db #5f,#5f,#5f,#6a,#6a,#7f,#7f,#7f
	db #7f,#7f,#7f,#7f,#7f,#19,#00,#0a
	db #00,#01,#00,#0a,#00,#19,#00,#0a
	db #00,#01,#00,#0a,#00,#19,#00,#0a
	db #00,#01,#00,#0a,#00,#19,#00,#0a
	db #0a,#01,#00,#01,#01,#19,#00,#0a
	db #00,#01,#00,#0a,#00,#19,#00,#0a
	db #00,#01,#00,#0a,#00,#19,#00,#0a
	db #00,#01,#00,#0a,#00,#19,#00,#0a
	db #0a,#01,#00,#01,#01,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
.l5270
	call #bcaa
	jr nc,l5270
	ret
.l5276
	call #bb1b
	ret nc
	pop bc
	pop bc
	pop bc
	call #bca7
	ret
.l5287 equ $ + 6
.l5285 equ $ + 4
.l5284 equ $ + 3
.l5282 equ $ + 1
.l5281
	db #04,#45,#05,#50,#50,#00,#56,#0f
.l528a equ $ + 1
	db #00,#01,#00,#00,#00,#00,#00,#00
.l5293 equ $ + 2
	db #0f,#00,#02,#00,#00,#00,#00,#00
	db #00,#0f,#00
.l529c
	ld c,#30
.l529e
	ld b,#ff
.l52a0
	djnz l52a0
	push bc
	call l5276
	pop bc
	dec c
	jr nz,l529e
	ret
.l52ab
	db #00,#00,#00
;
.play_music
.l52ae
;
	sub a
	ld (l5358),a
	ld (l535b),a
	ld (l5359),a
	ld (l535a),a
	call l52d0
	call l535c
	call l54fc
	call l55ab
	call l529c
	call #bca7
	jp l52ab
.l52d0
	ld b,#00
.l52d2
	ld a,b
	cp #0b
	jr c,l52e0
	cp #0f
	jr nc,l52e0
	ld a,#03
	jp l52e1
.l52e0
	sub a
.l52e1
	ld (l5282),a
	ld hl,l5005
	ld a,b
	and a
	jr z,l52f0
.l52eb
	inc hl
	inc hl
	dec a
	jr nz,l52eb
.l52f0
	ld a,(hl)
	ld (l5284),a
	inc hl
	ld a,(hl)
	ld (l5285),a
	ld hl,l5045
	ld e,b
	ld d,#00
	add hl,de
	ld a,(hl)
	ld (l5287),a
	push bc
	ld hl,l5281
	call l5270
	ld hl,l528a
	call l5270
	ld hl,l5293
	call l5270
	call l5276
	pop bc
	inc b
	ld a,b
	cp #20
	jr nz,l52d2
	ret
.l5322
	db #04,#00,#00,#71,#00,#00,#0d,#03
.l5331 equ $ + 7
.l532f equ $ + 5
.l532e equ $ + 4
.l532c equ $ + 2
.l532b equ $ + 1
	db #00,#04,#45,#05,#50,#50,#00,#56
.l5337 equ $ + 5
.l5334 equ $ + 2
	db #0c,#00,#02,#03,#06,#50,#00,#00
.l533d equ $ + 3
	db #0d,#0f,#00,#02,#03,#00,#01,#00
.l5349 equ $ + 7
.l5346 equ $ + 4
.l5342
	db #42,#0e,#0f,#00,#01,#00,#05,#50
.l534f equ $ + 5
.l534c equ $ + 2
	db #00,#00,#56,#0f,#00,#01,#00,#05
.l5359 equ $ + 7
.l5358 equ $ + 6
.l5355 equ $ + 3
.l5352
	db #50,#00,#00,#56,#0f,#00,#00,#00
.l535b equ $ + 1
.l535a
	db #00,#00
.l535c
	sub a
	ld (l535b),a
.l5360
	ld a,(l535b)
	ld c,a
	ld b,#00
.l5366
	ld a,b
	cp #0b
	jr c,l5373
	cp #0f
	jr nc,l5373
	ld a,#03
	jr l5374
.l5373
	sub a
.l5374
	ld (l532c),a
	ld hl,l5005
	ld a,b
	and a
	jr z,l5383
.l537e
	inc hl
	inc hl
	dec a
	jr nz,l537e
.l5383
	ld a,(hl)
	ld (l532e),a
	inc hl
	ld a,(hl)
	ld (l532f),a
	ld hl,l5045
	ld e,b
	ld d,#00
	add hl,de
	ld a,(hl)
	ld (l5331),a
	ld hl,l5065
	add hl,de
	ld a,(hl)
	ld (l5337),a
	ld (l5342),a
	ld hl,l50a5
	add hl,de
	ld a,(hl)
	ld (l5349),a
	ld hl,l50e5
	add hl,de
	ld a,(hl)
	dec a
	dec a
	ld (l534c),a
	ld hl,l50c5
	add hl,de
	ld a,(hl)
	ld (l5352),a
	ld hl,l5105
	add hl,de
	ld a,(hl)
	dec a
	dec a
	ld (l5355),a
	ld hl,l5000
	ld e,c
	add hl,de
	ld a,(hl)
	ld (l5358),a
	push bc
	ld hl,l5322
	call l5270
	ld hl,l532b
	call l5270
	ld a,(l5337)
	cp #20
	jr nc,l53ec
	ld hl,l533d
	call l5270
	jp l53f2
.l53ec
	ld hl,l5334
	call l5270
.l53f2
	ld a,(l5358)
	cp #01
	jr nz,l5402
	ld hl,l5346
	call l5270
	jp l5415
.l5402
	cp #02
	jr nz,l540f
	ld hl,l534f
	call l5270
	jp l5415
.l540f
	ld hl,l528a
	call l5270
.l5415
	call l5276
	pop bc
	inc b
	ld a,b
	cp #20
	jp nz,l5366
	ld a,(l535b)
	inc a
	ld (l535b),a
	cp #05
	jp nz,l5360
	ld a,(l5359)
	cp #64
	ret z
	jp l5462
.l5435
	db #04,#00,#00,#5f,#00,#00,#0d,#03
.l5444 equ $ + 7
.l5442 equ $ + 5
.l5441 equ $ + 4
.l543e equ $ + 1
	db #00,#04,#00,#05,#50,#50,#00,#56
.l544a equ $ + 5
.l5447 equ $ + 2
	db #0c,#00,#01,#00,#05,#50,#00,#00
.l5453 equ $ + 6
.l5450 equ $ + 3
	db #0d,#0f,#00,#02,#03,#06,#50,#00
.l5459 equ $ + 4
	db #00,#0e,#0f,#00,#02,#03,#00,#01
.l545e equ $ + 1
	db #00,#42,#0e,#0f,#00
.l5462
	ld c,#00
.l5464
	ld b,#00
.l5466
	ld hl,l5125
	ld a,b
	and a
	jr z,l5472
.l546d
	inc hl
	inc hl
	dec a
	jr nz,l546d
.l5472
	ld a,(hl)
	ld (l5441),a
	inc hl
	ld a,(hl)
	ld (l5442),a
	ld hl,l51a5
	ld e,b
	ld d,#00
	add hl,de
	ld a,(hl)
	ld (l5444),a
	ld hl,l51e5
	add hl,de
	ld a,(hl)
	ld (l544a),a
	ld hl,l5065
	add hl,de
	ld a,(hl)
	ld (l5453),a
	ld (l545e),a
	push bc
	ld hl,l5435
	call l5270
	ld hl,l543e
	call l5270
	ld hl,l5447
	call l5270
	ld a,(l5453)
	cp #20
	jr nc,l54bc
	ld hl,l5459
	call l5270
	jp l54c2
.l54bc
	ld hl,l5450
	call l5270
.l54c2
	call l5276
	pop bc
	inc b
	ld a,b
	cp #40
	jp nz,l5466
	inc c
	ld a,c
	cp #02
	jp nz,l5464
	ld a,#01
	ld (l535b),a
	ld a,#64
	ld (l5359),a
	jp l5360
.l54e5 equ $ + 4
.l54e4 equ $ + 3
	db #04,#00,#05,#50,#50,#00,#56,#0f
.l54ea equ $ + 1
	db #00,#02,#00,#05,#e1,#00,#00,#0d
.l54f6 equ $ + 5
.l54f3 equ $ + 2
	db #0f,#00,#01,#00,#05,#50,#00,#00
.l54f9
	db #56,#0f,#00
.l54fc
	ld a,#20
	ld (l535a),a
	ld c,#00
.l5503
	ld b,#10
.l5505
	ld hl,l5005
	ld a,b
	and a
	jr z,l5511
.l550c
	inc hl
	inc hl
	dec a
	jr nz,l550c
.l5511
	ld a,(hl)
	ld (l54e4),a
	inc hl
	ld a,(hl)
	ld (l54e5),a
	ld hl,l5065
	ld d,#00
	ld e,b
	add hl,de
	ld a,(hl)
	ld (l5453),a
	ld (l545e),a
	ld hl,l50c5
	add hl,de
	ld a,(hl)
	ld (l54f6),a
	ld hl,l5105
	add hl,de
	ld a,(hl)
	dec a
	ld (l54f9),a
	push bc
	ld a,(l5453)
	and a
	jp z,l555a
	ld a,(l5453)
	cp #20
	jr nc,l5551
	ld hl,l5459
	call l5270
	jp l5560
.l5551
	ld hl,l5450
	call l5270
	jp l5560
.l555a
	ld hl,l54ea
	call l5270
.l5560
	ld hl,l54f3
	call l5270
	call l5276
	pop bc
	inc b
	ld a,(l535a)
	cp b
	jp nz,l5505
	ld a,#1a
	ld (l535a),a
	inc c
	ld a,c
	cp #02
	jr nz,l5503
	ret
.l557e
	db #02,#00,#00,#00,#00,#00,#00,#2d
.l558d equ $ + 7
.l5587 equ $ + 1
	db #00,#01,#00,#05,#71,#00,#00,#56
.l5590 equ $ + 2
	db #0f,#00,#04,#00,#05,#5a,#02,#00
.l5599 equ $ + 3
.l5596
	db #56,#0f,#00,#04,#00,#05,#86,#03
.l55a2 equ $ + 4
.l559f equ $ + 1
	db #00,#56,#0f,#00,#04,#00,#00,#00
	db #00,#00,#00,#0f,#00
.l55ab
	ld b,#0e
.l55ad
	ld a,b
	ld (l558d),a
	ld (l5596),a
	ld (l559f),a
	push bc
	ld hl,l557e
	call l5270
	ld hl,l5587
	call l5270
	ld hl,l5587
	call l5270
	ld hl,l5587
	call l5270
	ld hl,l5590
	call l5270
	ld hl,l5599
	call l5270
	ld hl,l55a2
	call l5270
	call l5276
	pop bc
	dec b
	ld a,#08
	cp b
	jr nz,l55ad
	ret
	
;
.init_music	; added by Megachur
;
	call real_init_music
	jp play_music
;
.game_name
	db "Oxphar",0
.game_year
	db "1987",0
.game_publisher
	db "Ere Informatique",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
